import React, {useState} from 'react';
import {Button, Grid, Typography} from "@material-ui/core";
import {useDispatch} from "react-redux";
import {selectDeselectActivityName} from "../../../../../../../redux/reducers/editor";
import MenuMultiSelect from "../../../../Common/MenuMultiSelect/MenuMultiSelect";
import SnackbarMessage from "../../../../Common/Snackbar/SnackbarMessage";

export default function ActivityName(props) {
  // Props
  const {activityNameData, selectedActivityName} = props;

  // Local constants
  const dispatch = useDispatch();

  const handleSelectActivityName = (event, values) => {
    dispatch(selectDeselectActivityName(values));
  };

  const handleSelectAllActivityNames = () => {
    dispatch(selectDeselectActivityName(activityNameData));
  }

  return (
    <>

      <MenuMultiSelect
        name={"List of Activities"}
        dataSource={activityNameData}
        itemName={selectedActivityName}
        selectAll={handleSelectAllActivityNames}
        handleChange={handleSelectActivityName}
      />

    </>
  )
};
